package com.rxst.msg.webSocket.utils;

import com.rxst.msg.webSocket.MyWebSocketService;
import org.java_websocket.WebSocket;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Component
public class SocketServerUtils {

    private static Integer serverPort;  //直播评论服务端socket端口


    @Value("${socket.server.port}")
    public void setSocketServerPort(Integer port) {
        serverPort = port;
    }


    public static Map<String, List<WebSocket>> listMap = new HashMap<>();


    public static void Init() {
        listMap.clear();

        try {
            MyWebSocketService webSocketServer = new MyWebSocketService(serverPort);
            webSocketServer.start();
        } catch (Exception ex) {

        }
    }


}
